home *** CD-ROM | disk | FTP | other *** search
Korn shell script | 1995-03-24 | 797 b | 38 lines |
- #! /bin/ksh
- USAGE='USAGE: find_links [ ROOT_DIR ]
- Print to stdout lines with FILE_PATH and LINK for every
- link on the hard disk.
- '
- # (C) Copyright 1995 by Michael Coulter. All rights reserved.
-
- # Process parameters
-
- if [ $# -gt 1 ]
- then
- echo "$USAGE" >&2
- echo "Too many arguments." >&2
- exti 1
- fi
- ROOT_DIR="/"
- if [ $# -gt 0 ]
- then
- ROOT_DIR="$1"; shift
- fi
- if [ ! -d "$ROOT_DIR" ]
- then
- echo "$USAGE" >&2
- echo "$ROOT_DIR is not a directory" >&2
- exti 1
- fi
-
- # Do find
-
- find ${ROOT_DIR} \
- -path '/mnt/*' -prune \
- -o -path '/cdmnt/*' -prune \
- -o -path '/tmp/*' -prune \
- -o -path '/proc/*' -prune \
- -o -path '/var/tmp/*' -prune \
- -o -path '/var/utmp/*' -prune \
- -o -type l
-